package com.resource.provider.controller;

import com.commons.utils.Result;
import com.resource.interfaces.interfacex.AnswersService;
import com.resource.interfaces.vo.Survey;
import com.shikonghualian.logicalhat.Param;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author try
 * @date 2020/06/29
 */
@RestController
@Api(description = "答卷")
@RequestMapping(value = "/answers")
public class AnswersController {

    @Resource
    AnswersService answersService;

    @ApiOperation(value = "答卷提交")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(paramType = "query", name = "token", value = "鉴权参数", required = true, dataType = "String"),
                    @ApiImplicitParam(paramType = "query", name = "surveyId", value = "问卷id", required = true, dataType = "Integer")}
    )
    @RequestMapping(value = "/submit", method = RequestMethod.POST)
    @ResponseBody
    public Result answersSubmit(@Param("token") String token , @RequestBody Survey survey) {
        return answersService.answersSubmit(token,survey);
    }


}
